package com.solcoo.customer.ui.find;

import android.os.Bundle;
import android.widget.ListView;

import com.solcoo.customer.Constant;
import com.solcoo.customer.R;
import com.solcoo.customer.base.task.TaskHelper;
import com.solcoo.customer.base.task.TaskHelper.Callback;
import com.solcoo.customer.base.task.TaskHelper.DefaultCallback;
import com.solcoo.customer.model.ShopListDO;
import com.solcoo.customer.ui.ToolBarActivity;
import com.solcoo.customer.ui.shop.ShopDetailActivity;

public class FindActivity extends ToolBarActivity {

	FindAdapter adapter;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.find);
		ListView cardList = (ListView) findViewById(R.id.find_list);
		adapter = new FindAdapter(this);
		cardList.setAdapter(adapter);
		cardList.setOnItemClickListener(ShopDetailActivity.shopOnItemClickListener);
		TaskHelper.loadView(this, Constant.URL.getFind(), callback,
				ShopListDO.class);
	}

	private Callback<ShopListDO> callback = new DefaultCallback<ShopListDO>(
			this) {

		@Override
		public void onSuccess(ShopListDO result) {
			adapter.update(result);
		}

	};

	@Override
	protected int getCurId() {
		return 0;
	}
}
